<%
## Tangent, an online sign-up sheet
## Copyright (C) 2008 Justin Ludwig and Adam Stuenkel
## 
## This program is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License
## as published by the Free Software Foundation; either version 2
## of the License, or (at your option) any later version.
## 
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.
## 
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
## 02110-1301, USA.
-%>

<% @page_title = "Edit #{@event.name}" %>
<h1>Edit <%=h @event.name %></h1>

<p><%= link_to 'View Public Event Page', @event %></p>

<%= error_messages_for :event %>

<% form_for(@event, :builder => ApplicationFormBuilder) do |f| %>

<fieldset>
  <legend>Event Info</legend>
<%= f.property_line :text_field, :name, :required => true %>
<%= f.hidden_array_field :temp_coordinator_ids %>
<%= f.property_line :text_field, :tag_list, :label => "Tags", :description => "separate with commas" %>
<%= f.property_line :datetime_input, :start_date, :label => "Start", :required => true, :description => "free-form date like \"tomorrow\" or \"tues 1pm\" or \"2/28/09\"" %>
<%= f.property_line :datetime_input, :end_date, :label => "End", :description => "free-form date like \"tomorrow\" or \"tues 1pm\" or \"2/28/09\"" %>
<%= f.property_line :html_editor, :details, :class => "long", :rows => 10, :label => "Full-Page Details" %>
</fieldset>

<div class="buttons">
    <%= f.styled_submit "Update", :style => "width:6em;" %>
    <%= styled_button_to_back "Cancel", :style => "width:6em;" %>
</div>

<% end %>

<table class="tbl">
<caption>Activities</caption>
<thead>
  <tr>
    <th><%= link_to_order_by "Name", "name" %></th>
    <th>Tags</th>
    <th>Criteria</th>
    <th><%= link_to_order_by "Openings", "openings" %></th>
    <th><%= link_to_order_by "Start", "start_date" %></th>
    <th><%= link_to_order_by "End", "end_date" %></th>
    <th class="tools">&nbsp;</th>
  </tr>
</thead>
<tbody>
<% for activity in @activities %>
  <tr class="<%= cycle("", "alt") -%>">
    <td><%= link_to h(activity.name), edit_activity_path(activity) %></td>
    <td><%=h activity.tag_list %></td>
    <td><%=h activity.criteria %></td>
    <td><%=h activity.openings %></td>
    <td><%= list_datetime activity.start_date %></td>
    <td><%= list_datetime activity.end_date %></td>
    <td class="tools">
      <%= link_to titled_image_tag("silk/page_edit.png", :alt => "Edit"), edit_activity_path(activity) %>
	  <%= link_to_delete activity %>
    </td>
  </tr>
<% end %>
</table>
<%= links_to_page @activities %>
<div class="tbl-foot">
<div class="lr-container">
<span class="l">
    &nbsp;
</span>
<span class="r">
	<%= styled_button_to_function "New Activity", "document.location.href='#{new_event_activity_path @event}'" %>
</span>
</div>
</div>

